define('formBusinessTravel',['text!../tpl/form-business-travel.html','tool','common'],function(Template,tool,common){
    var App ={
    	template:Template,
    	mixins: [tool.toor,common.common],
    	mounted:function(){
    		var _this=this;
    	},
    	data:function(){
    		return{
    			submitJson:{
				    "component": [
	    			   {
	    			   	   "name": "出差事由",
					       "value": ''
	    			   },
	    			   {
	    			   	  "name":"出差天数",
	    			   	  "value":''
	    			   },
	    			   {
	    			   	  "name":"出差备注",
	    			   	  "value":''
	    			   },
	    			   {
	    			   	  "name":"成本中心",
	    			   	  "value":''
	    			   },
	    			   {
	    			   	  "name":"发票抬头",
	    			   	  "value":''
	    			   },
	    			   {
	    			   	  "name":"同行人",
	    			   	  "value":''
	    			   }
				    ]
				}
    		
    		};
    	},
    	methods:
    	{
    		repeatFn:function(data)
    		{
		     	if(data && data.length>0)
		     	{
		     	    for(var i=0;i<this.submitJson.component.length;i++)
		     	    {
		     	    	 var o=this.submitJson.component[i];
		     	    	 if(o.name=="明细")
		     	    	 {
		     	    	 	this.submitJson.component.splice(i,1)
		     	    	 }
		     	    };
		     	    for(var i=0,o;o=data[i++];)
		     	    {
		     	    	 if(o[4].value!=''){
		     	    	 	o[4].value=new Date(o[4].value).Format('yyyy-MM-dd');
		     	    	 };
		     	    	 if(o[5].value!='')
		     	    	 {
		     	    	 	 o[5].value=new Date(o[5].value).Format('yyyy-MM-dd');
		     	    	 }
		     	    }
		     		this.submitJson.component.push({
		     			  "name":"明细",
		     			  "value":JSON.stringify(data)
		     		});
		     	}
    		}
    	}
    };
    return {
        app:App       
    };
});